package com.mf.controller;

import com.mf.entity.Chart;
import com.mf.service.impl.ChartServiceImpl;
import com.mf.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mf
 * @since 2024-04-24
 */
@RestController
@RequestMapping("/chart")
@Tag(name="表格数据")
public class ChartController {
    @Resource
    private ChartServiceImpl chartService;
    @GetMapping("/getChartData")
    @Operation(summary = "获取表格数据")
    public Result<List<Chart>> getChartData(){
        return Result.success(chartService.list());
    }

    @PostMapping("/add")
    @Operation(summary = "添加数据")
    public Result<Boolean> add(@RequestBody Chart chart){
        return Result.success(chartService.save(chart));
    }

}
